﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;
namespace BLL.Sec
{
    /// <summary>
    /// 业务逻辑类SEC_ROLE_TYPE 的摘要说明。
    /// </summary>
    public class SEC_ROLE_TYPE
    {
        private readonly OracleDAL.Sec.SEC_ROLE_TYPE dal = new OracleDAL.Sec.SEC_ROLE_TYPE();
        public SEC_ROLE_TYPE()
        { }
        #region  成员方法

        /// <summary>
        /// 得到最大ID
        /// </summary>
        public int GetMaxId()
        {
            return dal.GetMaxId();
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int ROLEID)
        {
            return dal.Exists(ROLEID);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Model.Sec.SEC_ROLE_TYPE model)
        {
            dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Model.Sec.SEC_ROLE_TYPE model)
        {
            dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(int ROLEID)
        {

            dal.Delete(ROLEID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Sec.SEC_ROLE_TYPE GetModel(int ROLEID)
        {

            return dal.GetModel(ROLEID);
        }

       

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.Sec.SEC_ROLE_TYPE> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List<Model.Sec.SEC_ROLE_TYPE> modelList = new List<Model.Sec.SEC_ROLE_TYPE>();
            int rowsCount = ds.Tables[0].Rows.Count;
            if (rowsCount > 0)
            {
                Model.Sec.SEC_ROLE_TYPE model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.Sec.SEC_ROLE_TYPE();
                    if (ds.Tables[0].Rows[n]["ROLEID"].ToString() != "")
                    {
                        model.ROLEID = int.Parse(ds.Tables[0].Rows[n]["ROLEID"].ToString());
                    }
                    model.ROLENAME = ds.Tables[0].Rows[n]["ROLENAME"].ToString();
                    model.REMARK = ds.Tables[0].Rows[n]["REMARK"].ToString();
                    if (ds.Tables[0].Rows[n]["SORT"].ToString() != "")
                    {
                        model.SORT = int.Parse(ds.Tables[0].Rows[n]["SORT"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}
